package com.abcijkxyz.servlet;

import java.io.IOException;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.thymeleaf.TemplateEngine;
import org.thymeleaf.context.WebContext;

@WebServlet("/servlet")
public class IndexServlet extends HttpServlet {
	private static final long	serialVersionUID	= 1L;

	@Autowired
	private TemplateEngine		templateEngine;

	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
		WebContext context = new WebContext(request, response, request.getServletContext());
		context.setVariable("recipient", "World IndexServlet");
		templateEngine.process("index", context, response.getWriter());
	}

}
